//
// Copyright (c) 2024 BPer
//

#ifndef INCLUDE_BPERSTREAM_BPERSTREAM_H_
#define INCLUDE_BPERSTREAM_BPERSTREAM_H_
#include <bperutil/BPerType.h>
#include <bperstream/BPerStreamCapture.h>
#include <bperutil/BPerAvInfoType.h>
#include "BPerStreamType.h"
typedef struct{
	int32_t mediaServer;
	int32_t transtype;
	int32_t streamInit;
	int32_t uid;
	int32_t audioStream;
	int32_t videoStream;
	int32_t netState;
	void* context;
	BPerAVInfo* avinfo;
	BPerStreamConfig streamconfig;
}BPerStreamContext;
typedef struct {
	BPerStreamContext* context;

	int32_t (*connectServer)(BPerStreamContext* context);
	int32_t (*disConnectServer)(BPerStreamContext* context);
	int32_t (*reconnect)(BPerStreamContext* context);
	int32_t (*receiveData)(BPerStreamContext* context,int32_t *plen);
	int32_t (*publishAacheader)(BPerStreamContext* context,BPerFrame *audioFrame);
	int32_t (*publishVideoData)(BPerStreamContext* context,BPerStreamCapture *videoFrame);
	int32_t (*publishAudioData)(BPerStreamContext* context,BPerStreamCapture *audioFrame);
	int32_t (*publishMsg)(BPerStreamContext* context,BPerFrame *msgFrame);
	int32_t (*getConnectState)(BPerStreamContext* context);
	int32_t (*isconnected)(BPerStreamContext* context);
	int32_t (*isAlive)(BPerStreamContext* context);
	int32_t (*sendRtcMessage)(BPerStreamContext* context,BPerRtcMessageType mess);
}BPerStreamHandle;
#ifdef __cplusplus
extern "C"{
#endif
void bPer_create_stream(int32_t mediaServer,int32_t transType,BPerStreamHandle* streamHandle,BPerStreamConfig* streamconfig,BPerAVInfo* avinfo) ;
void bPer_destroy_stream(BPerStreamHandle* stream);
#ifdef __cplusplus
}
#endif
#endif /* INCLUDE_BPERSTREAM_BPERSTREAM_H_ */
